/*
package com.jiazhong.servlet.controller;

import com.alibaba.fastjson.JSONArray;
import com.jiazhong.commons.util.JsonResult;
import com.jiazhong.servlet.service.EmpService;
import com.jiazhong.servlet.service.impl.EmpServiceImpl;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/emp_find_page")
public class EmpFindPageController extends HttpServlet {

    private EmpService service;

    @Override
    public void init(ServletConfig config) throws ServletException {
        service = new EmpServiceImpl();
    }

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        // 1. 获取到用户的请求的参数
        int page = 1, size = 10;
        String p = request.getParameter("page");
        String s = request.getParameter("size");
        if (p != null) {
            page = Integer.parseInt(p);
        }
        if (s != null) {
            size = Integer.parseInt(s);
        }
        // 2. 调用具体的方法
        JsonResult str = service.findByPage(page, size);
        // 3. 响应
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().println(JSONArray.toJSONString(str));
    }
}
*/
